<template>
    <div id="app-main" class="sip">
        <!--<retrieval></retrieval>-->
        <router-view></router-view>
    </div>
</template>
<script>

import { stopBackSpace } from '@/util/ieStopBack'
// import retrieval from '@/module/retrieval.umd.js'
export default {
  // name: 'App'
  components: {},
  computed: {
    StorageType() {
      return this.$store.getters.getStorageType;
    }
  },
  beforeCreate() {

  },

  created() {
    window.$ready = false;
    document.onkeypress = stopBackSpace;
    document.onkeydown = stopBackSpace;
    console.info('本地存储位置:', this.StorageType);

    for (let i = 0; i < this.StorageType.length; i++) {
      if (window[this.StorageType[i]].getItem('store')) {
        this.$store.replaceState(
          Object.assign(
            {},
            this.$store.state,
            JSON.parse(window[this.StorageType[i]].getItem('store'))
          )
        );
      }
    }
    window.addEventListener('beforeunload', () => {
      this.$store.state.home.params = null;
      for (let i = 0; i < this.StorageType.length; i++) {
        window[this.StorageType[i]].setItem('store', JSON.stringify(this.$store.state));
      }
    });
  }
};
</script>
<style>
    #app-main {
        height: 100%;
        width: 100%;
    }
</style>
